home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group93b.txt
/
000095_icon-group-sender _Fri May 14 02:01:30 1993.msg
< prev
next >
Wrap
Internet Message Format
|
1993-06-16
|
2KB
Received: from owl.CS.Arizona.EDU by cheltenham.cs.arizona.edu; Mon, 17 May 1993 07:43:52 MST
Received: by owl.cs.arizona.edu; Mon, 17 May 1993 07:43:51 MST
Date: 14 May 93 02:01:30 GMT
From: amethyst!organpipe.uug.arizona.edu!news@noao.edu (Dave Schaumann)
Organization: University of Arizona
Subject: Re: Icon vs Prolog, docs, availability ?
Message-Id: <1993May14.020130.17872@organpipe.uug.arizona.edu>
References: <borbor-130593120939@129.194.82.105>
Sender: icon-group-request@cs.arizona.edu
To: icon-group@cs.arizona.edu
Status: R
Errors-To: icon-group-errors@cs.arizona.edu
In article <borbor-130593120939@129.194.82.105>, borbor@divsun (Boris Borcic) writes:
>I have read in this group that Icon uses a backtracking
>mechanism very similar to Prolog. Would a user of both
>languages care to sketch Icon with Prolog as background ?
>What are the most significant differences ?
Probably the most significant difference is that Icon is a (mostly)
imperative language. Thus, most Icon programs tend to be (mostly)
imperative.
On the other hand, I was just working on implementing an algorithm for
which backtracking worked out very nicely. The algorithm (in part)
maintians a list of sets. Part of the algorithm is a loop which selects
an element from one of these sets. The pseudo-code is expressed as
Select a in (size of list) and i in L[a]. The loop terminates when
L[a] is empty for all a.
This can be expressed very nicely in Icon as
while a := 1 to *L & i := !L[a] do {
# do the loop stuff
}
Here, Icon's backtracking feature is used to elide the fact that (in general)
you have to loop to find appropriate values of a and i.
It's been a long time since I did any Prolog programming, so I can't
speak directly to the relative strengths of each language, but I wouldn't
be to surprised if one could write a fairly complete Prolog interpreter
in Icon with relatively few lines of code (particularly since you have the
backtracking feature "for free").
--
Dave Schaumann dave@cs.arizona.edu